// 所有请求接口
const install = (Vue, vm) => {
	// 登录
	let login = (params = {}) => vm.$u.post('sys/login', params);
	// 退出登录
	let logout = (params = {}) => vm.$u.post('sys/logout', params);
	// 修改密码
	let updatePassword = (params = {}) => vm.$u.post('user/updatePassword', params);
	// 禁止用户
	let userDisable = (params = '') => vm.$u.get('user/disable/'+ params);
	// 解除禁用
	let relieve = (params = '') => vm.$u.get('user/relieve/'+ params);
	// 修改用户
	let updateUser = (params = {}) => vm.$u.post('user/updateUser', params);
	// 获取用户列表
	let getAllByPage = (params = {}) => vm.$u.post('user/getAllByPage', params);
	// 获取所有房源设施
	let getAllFacilities = (params = '') => vm.$u.get('housing/getAllFacilities', params);
	// 发布房源
	let addHousingInfo = (params = {}) => vm.$u.post('housing/updateHousingInfo', params);
	// 查询房源
	let searchByPage = (params = {}) => vm.$u.post('housing/searchByPage', params);
	// 删除图片
	let deleteImg = (params = '') => vm.$u.get('file/delete/'+ params);
	// 发布的房源信息
	let releaseHous =  (params = '') => vm.$u.get('housing/getByUserId/'+ params);
	// 下架的房源信息
	let shelfHous =  (params = '') => vm.$u.get('housing/getShelfByUserId/'+ params);
	// 下架房源
	let shelf =  (params = '') => vm.$u.get('housing/shelf/'+ params);
	// 获取房源详情
	let getHousDetail =  (params = '') => vm.$u.get('housing/getById/'+ params);
	// 分享
	let signature =  (params = '') => vm.$u.post('wechat/signature', params);
	// 上架
	let shelves =  (params = '') => vm.$u.get('housing/shelves/'+ params);
	// 分享房源信息
	let share = (params = '') => vm.$u.get('housing/share/'+ params);
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = { login,logout,updatePassword,userDisable,updateUser,getAllByPage,getAllFacilities,addHousingInfo,relieve,searchByPage,deleteImg,
	releaseHous,shelfHous,shelf,getHousDetail,signature,shelves,share};
}

export default {
	install
}